/*-----------------------------------------------------------------------------
 * ServiceManager.h
 *-----------------------------------------------------------------------------
 * 
 *-----------------------------------------------------------------------------
 * All rights reserved by Rho Yong Hwan (fixbrain@gmail.com, unsorted@msn.com)
 *-----------------------------------------------------------------------------
 * Revision History:
 * Date					Who					What
 * ----------------		----------------	----------------
 * 04.10.2007			Rho Yong Hwan		birth
**---------------------------------------------------------------------------*/
#pragma once

#ifdef SERVICE_MANAGER_EXPORTS
	#ifdef __cplusplus
		#define SERVICE_MANAGER_API			extern "C" __declspec(dllexport) 
		#define SERVICE_MANAGER_CLASS		__declspec(dllexport) 
	#else
		#define SERVICE_MANAGER_API			__declspec(dllexport)	
	#endif//__cplusplus
#else
	#ifdef __cplusplus
		#define SERVICE_MANAGER_API			extern "C" __declspec(dllimport)
		#define SERVICE_MANAGER_CLASS		__declspec(dllimport) 
	#else
		#define SERVICE_MANAGER_API			__declspec(dllimport)
	#endif//__cplusplus		
#endif//SERVICE_MANAGER_EXPORTS


#include "StatusCode.h"




// 
// ServiceManager context handle
// 
typedef void* SVCMGR_CTX;


SERVICE_MANAGER_API
SVCMGR_CTX InstallDriver(
	IN PCWSTR DriverPath, 
	IN PCWSTR DriverServiceName, 
	IN PCWSTR DriverServiceDisplayName
	);

SERVICE_MANAGER_API 
void UninstallDriver(IN SVCMGR_CTX Context);

SERVICE_MANAGER_API 
DTSTATUS StartDriverService(IN SVCMGR_CTX Context);

SERVICE_MANAGER_API
DTSTATUS StopDriverService(IN SVCMGR_CTX Context);


SERVICE_MANAGER_API
void ReleaseContext(IN SVCMGR_CTX& Context);

SERVICE_MANAGER_API
HANDLE GetDriverHandle(IN SVCMGR_CTX Context);

SERVICE_MANAGER_API
DWORD ReleaseDriverHandle(IN SVCMGR_CTX Context);	

SERVICE_MANAGER_API
DTSTATUS
SendDriverCommand(
	IN SVCMGR_CTX Context, 
	IN DWORD IoControlCode,
	IN LPVOID InputBuffer, 
	IN DWORD InputBufferLength, 
	IN OUT LPVOID OutputBuffer, 
	IN DWORD OutputBufferLength, 
	IN OUT PDWORD BytesReturned,
	IN LPOVERLAPPED Overlapped
	);










